The present invention relates to methods and systems for warping digital images.
Digital image warping is a form of image processing that uses geometric transformation techniques in order to achieve a wide variety of different artistic effects or image corrections related to changing the shape and size of objects in the image. Generally, an image processing application (computer program) will have a number of predefined warping functions referred to as xe2x80x98cannedxe2x80x99 transforms. Each such transform represents a particular artistic effect and is described by a small set of functions depending on a limited number of parameters. By selecting one or more of the canned transforms, a user can perform a limited set of distortions on an image. Although canned transforms offer a variety of effects, they lack flexibility. Many kinds of distortions cannot be performed with canned transforms, which are good only for the effect for which they are designed.
General warping offers much more flexibility than the canned transforms. In general warping, the user defines the desired distortions at a number of points and then a warping engine interpolates the distortions to all of the remaining pixels of the image. Conventional warping applications allow the user to define and apply a variety of warping interpolations such as bilinear and bi-cubic. This has been done in different ways, with different levels of smoothness and flexibility.
General warping achieves its greater flexibility at a high cost of user effort. To achieve a good visual effect, the user must define the distortion at a large number of points throughout the image. Often, general warping requires that the user define hundreds of points of distortion xe2x80x98by handxe2x80x99, which is labor intensive and time consuming.
In general, the invention provides a method and apparatus, including a computer program apparatus, implementing techniques to iteratively build meshes for image warping, where each mesh represents a solution to corresponding differential equation.
According to one aspect, the techniques are directed to a method of processing an input image using an array of displacement values, referred to as a xe2x80x9cmeshxe2x80x9d of displacement values or as a displacement xe2x80x9cmap.xe2x80x9d Each element of the array contains a value representing a displacement for a plurality of pixels of the input image. A kernel, related to a transformation function, is iteratively applied to the array until a termination condition is achieved, such as the convergence of the displacement values to a solution of a differential equation. During each iteration, user-selected elements of the array define the boundary conditions for the transformation function. The new displacement values are written to selected elements without updating the displacement values of the non-selected elements. Finally, the digital image is warped according to the new displacement values.
The user can define the initial array of displacement values and can edit the array throughout the process. After applying a kernel to the mesh, the user can preview the resulting warped image. The user can elect to further edit the mesh and apply other kernels or, if a desired warping effect has been achieved, can apply the mesh to the original image, thereby warping the image in accordance with the new displacement values.
In another aspect, the invention is directed to a system in which an iteration engine executes within an operating environment provided by a computer. The iteration engine is given a plurality of selected elements from the array and iteratively applies the kernel to the array to update the selected elements with new displacement values until a termination condition is achieved. Upon termination, a warping engine transforms the digital image according to the new displacement values, thereby warping the digital image.
The invention offers several advantages including greater flexibility than canned image transformations and greater control than general warping. By iteratively applying the kernels, the invention directly constructs a transformation function as a solution to a corresponding differential equation based on user-defined boundary conditions.
Various embodiments of the invention are set forth in the accompanying drawings and the description below. Other features and advantages of the invention will become apparent from the description, the drawings, and the claims.